avoid relatedTemplate ever returning ""
authorJoey Hess <joeyh@joeyh.name>
Thu, 4 Sep 2025 17:01:59 +0000 (13:01 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 4 Sep 2025 17:02:46 +0000 (13:02 -0400)
commit67f00027d1b326c979db8b81c973a61234c406d7
tree8c6ed7e66a624b9198ae95c813d02ac12ef02822
parent4b037dda819975ecdf5bddef3b73e6cdcf7fb07c
avoid relatedTemplate ever returning ""

add: Fix crash adding filenames that are exactly 21 bytes long and begin
with a utf-8 character.

Also longer filenames that start with "....." would cause the same crash.

I also audited for other calls to truncateFilePath that could truncate it
to "". Most use pathmax so are not a problem. Backend.Utilities.genKeyName
could possibly truncate it like that, but appends the md5 so would not be a
problem either.

Sponsored-by: Kevin Mueller
CHANGELOG
Utility/FileSystemEncoding.hs
Utility/Tmp.hs
doc/bugs/git-annex_add__47__unlock_fails_for_some_names.mdwn
doc/bugs/git-annex_add__47__unlock_fails_for_some_names/comment_1_af33dfae3ccbc24f84c84612337b98bc._comment [new file with mode: 0644]